import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class HomeBottomClipper extends CustomClipper<Path>{

  final double subHeight;
  HomeBottomClipper({
    this.subHeight = 0
  });

  @override
  Path getClip(Size size){
    var path = Path();
    path.lineTo(0, 0); //第1个点
    path.lineTo(0, (size.height-(44.h + ScreenUtil().statusBarHeight)) + subHeight); //第2个点
    var firstControlPoint = Offset(size.width/2, size.height);
    var firstEdnPoint = Offset(size.width, (size.height-(44.h + ScreenUtil().statusBarHeight)) + subHeight);
    path.quadraticBezierTo(
      firstControlPoint.dx, 
      firstControlPoint.dy, 
      firstEdnPoint.dx, 
      firstEdnPoint.dy
    );
    path.lineTo(size.width, (size.height-(44.h + ScreenUtil().statusBarHeight)) + subHeight); //第3个点
    path.lineTo(size.width, 0); //第4个点

    return path;
  }
  @override
  bool shouldReclip(CustomClipper<Path> oldClipper) {
    return false;
  }
}